/*
*   pcb.h
*   Authors: Dustin Striplin
*   Contains all of the basic information about a process, also contains a pointer to the process
*/

#ifndef PCB_H
#define PCB_H

#include "global.h"
#include "ProcessADT.h"
#include "Request.h"


typedef struct pcb_str {
    int pid;
    int state;          // e.g. 0=running, 1=ready, 2=interrupted, 3=blocked
    ProcessPtr process;    // pointer to the actual process
    int waiting_on;     // which queue is it in if it is waiting on something (blocked)
    int owns;           // which mutex lock does it own

    void (*destruct)(struct pcb_str*);
    RequestPtr(*step)(struct pcb_str*);
} PCBStr;

typedef PCBStr* PCBPtr;

PCBPtr pcbConstructor(int pid, ProcessPtr proc);
void pcbDestructor(PCBPtr thePCB);
RequestPtr pcbStep(PCBPtr this);   //run another step

#endif
